//#include"ThreadPool_V1.hpp"
//#include"ThreadPool_V2.hpp"
//#include"ThreadPool_V3.hpp"
#include"ThreadPool_V4.hpp"
#include"Task.hpp"
#include<ctime>
#include<cstring>

using namespace std;

int main()
{
    srand(static_cast<unsigned int>(time(nullptr)));
    const char ops[]="+-*/%";
    ThreadPool<Task> *tp=new ThreadPool<Task>();
    tp->init();
    tp->start();

    while(true)
    {
        usleep(1000000);
        int x=rand()%100;
        int y=rand()%100;
        char op=ops[rand()%strlen(ops)];

        // int x,y;
        // char op;
        // cout<<"x=";
        // cin>>x;
        // cout<<"y=";
        // cin>>y;
        // cout<<"ch=";
        // cin>>op;

        Task t(x,y,op);
        ThreadPool<Task>::getInstance()->pushTask(t);
        cout<<"Task:"<<t.formatArg()<<"? "<<endl;
    }

    return 0;
}